using System;
using FU.Capstones.IMS.Web.Common;
using FU.Capstones.IMS.Web.Common.InventoryServiceProxy.DataContracts;
using FU.Capstones.IMS.Web.Common.InventoryServiceProxy.EventArgs;

namespace FU.Capstones.IMS.Web.Silverlight.Models
{
    public class EmploymentTypeDetailModel : ModelBase
    {
        public EmploymentTypeDetailModel()
        {
            client.GetSingleEmploymentTypeCompleted += DoGetSingleEmploymentTypeCompleted;
            client.InsertEmploymentTypeCompleted += DoInsertEmploymentTypeCompleted;
            client.UpdateEmploymentTypeCompleted += DoUpdateEmploymentTypeCompleted;
        }

        #region UpdateEmploymentType

        public event EventHandler<FeedbackCompletedEventArgs> UpdateEmploymentTypeCompleted;

        public int UpdateEmploymentTypeAsync(EmploymentType data)
        {
            client.UpdateEmploymentTypeAsync(data);
            return WebConstants.MagicNumer;
        }

        void DoUpdateEmploymentTypeCompleted(object sender, FeedbackCompletedEventArgs e)
        {
            if (UpdateEmploymentTypeCompleted != null)
            {
                UpdateEmploymentTypeCompleted(sender, e);
            }
        }

        #endregion

        #region InsertEmploymentType

        public event EventHandler<SingleFeedbackCompletedEventArgs<int>> InsertEmploymentTypeCompleted;

        public int InsertEmploymentTypeAsync(EmploymentType data)
        {
            client.InsertEmploymentTypeAsync(data);
            return WebConstants.MagicNumer;
        }

        void DoInsertEmploymentTypeCompleted(object sender, SingleFeedbackCompletedEventArgs<int> e)
        {
            if (InsertEmploymentTypeCompleted != null)
            {
                InsertEmploymentTypeCompleted(sender, e);
            }
        }

        #endregion

        #region GetSingleEmploymentType

        public event EventHandler<SingleFeedbackCompletedEventArgs<EmploymentType>> GetSingleEmploymentTypeCompleted;

        public int GetSingleEmploymentTypeAsync(int objID)
        {
            client.GetSingleEmploymentTypeAsync(objID);
            return WebConstants.MagicNumer;
        }

        void DoGetSingleEmploymentTypeCompleted(object sender, SingleFeedbackCompletedEventArgs<EmploymentType> e)
        {
            if (GetSingleEmploymentTypeCompleted != null)
            {
                GetSingleEmploymentTypeCompleted(sender, e);
            }
        }

        #endregion
    }
}